package com.mk.carcassonne;

public class FollowerPlacement {
	
	private FollowerPlacementType _placementType;
	private Position _position;
	private Boolean _isAvailable;
	
	public FollowerPlacement(FollowerPlacementType placementType, Position position, Boolean isAvailable)
	{
		_placementType = placementType;
		_position = position;
		_isAvailable = isAvailable;
	}
	
	@Override
	public String toString() {
		if(_placementType == FollowerPlacementType.CLOISTER)
			return "Cloister";
		
		if(_placementType == FollowerPlacementType.FIELD)
			return "Field";
		
		if(_placementType == FollowerPlacementType.ROAD)
			return "Road";
		
		if(_placementType == FollowerPlacementType.TOWN)
			return "Town";
		
		return "Item";
	}

	public Position getPosition() {
		return _position;
	}

	public void setIsAvailable(Boolean _isAvailable) {
		this._isAvailable = _isAvailable;
	}

	public Boolean isAvailable() {
		return _isAvailable;
	}
	
	public Position getRotatatedPosition(int rotation) {
		
		switch(rotation)
		{
			case 1:
				return new Position(100 - _position.getY(), _position.getX());
			case 2:
				return new Position(100 - _position.getX(), 100 - _position.getY());
			case 3:
				return new Position(_position.getY(), 100 - _position.getX());
			default:
				return _position;
		}
	}
}
